package com.ruoyi.system.mapper;


import com.ruoyi.system.domain.Article;
import com.ruoyi.system.domain.vo.DetailedArticle;
import com.ruoyi.system.domain.vo.FirstPageArticle;
import com.ruoyi.system.domain.vo.ShowArticle;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ArticleMapper {

    List<Article> getAllArticleQuery();
    List<FirstPageArticle> getArticleTagByUserId(Long userid);
    FirstPageArticle getArticleById(Long id);

    List<ShowArticle> getArticleByTagId(Long tagId);

    int saveArticle(Article article);

    int updateArticle(ShowArticle showArticle);

    void deleteArticle(Long id);

    /*========================评论相关==============================*/

    int getCommentCountById(Long id);


    /*========================首页相关===============================*/

    List<FirstPageArticle> getFirstAllArticles();

    DetailedArticle getDetailedArticle(Long id);

    List<FirstPageArticle> getSearchArticles(String query);

    Integer getArticleViewTotal();


    List<FirstPageArticle> getArticleInfoId(@Param("query") String query, @Param("tagId") Long tagId);

    int updateViews(Long id);

    List<FirstPageArticle> getArticleTagId(Long tagId);

}
